package edu.ahut.designpattern.chainresponsibility.joke;

public class BeautifulGirlHandler implements GirlHandler {
    @Override
    public void handle(String loveLetter) {
        //具体的处理逻辑
        if (loveLetter.toLowerCase().contains("beautiful")) {
            System.out.println("I am " + name + ",I like it!");
        } else if (next != null) {
            next.handle(loveLetter);
        }

    }

    //beautiful
    @Override
    public void setNextHandler(GirlHandler next) {
        this.next = next;

    }

    public BeautifulGirlHandler(String name) {
        this.name = name;
    }

    String name;
    GirlHandler next;


}
